<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">
    <title>Form Layouts</title>
    <link href="/public/js/summernote/dist/summernote.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/public/js/jquery-multi-select/css/multi-select.css" />
    <link rel="stylesheet" type="text/css" href="/public/js/jquery-tags-input/jquery.tagsinput.css" />
     <link href="/public/js/iCheck/skins/minimal/minimal.css" rel="stylesheet">
    <script language="javascript">
        function RunOnBeforeUnload() {window.onbeforeunload = function(){ return ""; } }
    </script>
    <?php $this->load->view('library/header');?>
</head>
<body onload="RunOnBeforeUnload()" class="sticky-header">
<?php $this->load->view('library/left');?>
<div class="main-content" >
    <?php $this->load->view('library/top');?>
    <div class="page-heading">
        <h3>
            管理授权
        </h3>
        <ul class="breadcrumb">
            <li>
                <a href="#">Forms</a>
            </li>
            <li class="active"> Forms Layouts </li>
        </ul>
    </div>
    <section class="wrapper">
        <div class="row">
            <div class="col-md-12">
                <section class="panel">
                    <header class="panel-heading custom-tab turquoise-tab">
                        <ul class="nav nav-tabs">
                            <li class="active">
                                <a href="#home2" data-toggle="tab">管理员</a>
                            </li>
                            <li class="">
                                <a href="#about2" data-toggle="tab">授权列表</a>
                            </li>
                        </ul>
                    </header>
                    <form id="commentForm" class="form-horizontal adminex-form" method="post">
                        <div class="panel-body">
                            <div class="tab-content">
                                <div class="tab-pane active" id="home2">
                                    <div class="form-group " style="    margin-left: 5%;">
										<?php foreach($admin_list as $k => $v){?>
	                                        <div class="col-md-10">
	                                            <div class="col-md-4" style="margin-left: -15px;">
	                                                <input type="radio" name="admin"  value="<?php echo $k?>"><?php echo $v?>
	                                            </div>
	                                        </div>
										<?php }?>

                                    </div>
                                </div>
                                <!-- <input style="margin-left: 20px;" value="<?php echo $val['id']?>" class="click_fa" type="checkbox" /> -->
                                <div class="tab-pane" id="about2">
                                    <?php foreach($controller as $key => $val){?>
										<div>
											<div class="minimal single-row a_key" data-key="<?php echo $key;?>" >
												<div class="checkbox ">
                                                	<input type="checkbox" name="controller[]" class="click_fa" web_id="<?php echo $k?>" value="<?php echo $val['id'];?>">
                                                <label class="web"><span><?php echo $val['describe']?></span></label>
                                            	</div>
											</div>
											<div style="margin-left: 5%;" class="aa">
											<?php if($val['son']){?>
												<?php foreach($val['son'] as $k => $v){?>
													<div class="list<?php echo $val['id']?> minimal single-row z-minimal all_key_<?php echo $key;?>" data-f-key="<?php echo $key;?>" >
													    <input style="margin-left: 20px;" value="<?php echo $v['id']?>" class="son<?php echo $val['id']?>" name="method[]" type="checkbox" /><?php echo $v['describe']?>
													</div>
												<?php }?>
											<?php }?>
											</div>
										</div>
									<?php }?>

									<!-- <footer class="panel-footer"> -->
			                            <button type="submit"  value="0" class="btn btn-post pull-right btn-big">提交信息
			                            </button>
			                            <ul class="nav nav-pills p-option"></ul>
                        <!-- </footer> -->
                                </div>
                            </div>
                        </div>
                        
                    </form>
                </section>
            </div>
        </div>
    </section>
    <footer>
        2014 &copy; AdminEx by
    </footer>
</div>
</section>
<?php $this->load->view('library/footer');?>
<script src="/public/js/nestable/jquery.nestable.js"></script>
<script src="/public/js/scripts.js"></script>
<script src="/public/js/iCheck/jquery.icheck.js"></script>
<script src="/public/js/icheck-init.js"></script>
<script>
$(function(){
        $('.a_key input').on('ifChecked', function(){
        	var key = $(this).parents('.a_key').attr('data-key');
    		$('.all_key_' + key + ' input').iCheck('check');
        });

        $('.a_key input').on('ifUnchecked', function(event){
            var key = $(this).parents('.a_key').attr('data-key');
            $('.all_key_' + key + ' input').iCheck('uncheck');
        });


// $('.z-minimal input').on('ifChecked', function(){
// 	var key = $(this).parents('.z-minimal').attr('data-f-key');
// 	$('.a_key[data-key="'+ key +'"]').iCheck('check');
// });
// $('.z-minimal input').on('ifUnchecked', function(event){
// 	var key = $(this).parents('.z-minimal').attr('data-f-key');
// 	var a = 0;				
// 	$('.all_key_' + key + ' input').each(function(i) {
// 		if (this.checked == true) {
// 			a = 1;
// 		}
// 	});
// 	if (a == 0) {
// 		$('.a_key[data-key="'+ key +'"]').iCheck('uncheck');
// 	}

	
// });





	// $('.iCheck-helper').click(function(){
	// 	var id = $(this).prev().val();
	// 	var checked = $(this).parent('.icheckbox_minimal').hasClass('checked');
	// 	if(checked == true){
	// 		$(".son"+id).parent('.icheckbox_minimal').addClass('checked');
	// 		$(".son"+id).parent('.icheckbox_minimal').children('input').attr('checked',true);
	// 	}else{
	// 		$(".son"+id).parent('.icheckbox_minimal').removeClass('checked');
	// 		$(".son"+id).parent('.icheckbox_minimal').children('input').attr('checked',false);
	// 		// $(".son"+id).parent('.icheckbox_minimal').children('input').attr('checked',false);
	// 	}
	// })

	// $('.iCheck-helper').click(function(){
	// 	$(this).parents('.aa').prev().children().children('.icheckbox_minimal').addClass('checked');
	// 	$(this).parents('.aa').prev().children().children().children('input').attr('checked',true);
	// })

})
</script>
</body>
</html>
   
 
